package com.aha.dataanalyzeandview.service.impl;

import com.aha.dataanalyzeandview.entity.metadata.ConnectionInfoEntity;
import com.aha.dataanalyzeandview.mapper.ConnectionInfoMapper;
import com.aha.dataanalyzeandview.service.IConnectionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Slf4j
@Service
public class ConnectionInfoServiceImpl implements IConnectionService {

    @Autowired
    private ConnectionInfoMapper connectionInfoMapper;

    @Override
    public List<ConnectionInfoEntity> queryAllConnectionInfo(Map<String, Object> map ) {
        return connectionInfoMapper.queryAllConnectionInfo(map );
    }

    @Override
    public boolean testConnection(ConnectionInfoEntity connectionInfoEntity) {


        return true;
    }

    @Override
    public Integer addConnectionInfo(ConnectionInfoEntity connectionInfoEntity) {
        Integer res = connectionInfoMapper.addConnectionInfo(connectionInfoEntity);
        log.info("获取插入数据源的id:" + connectionInfoEntity.getId());
        return connectionInfoEntity.getId();
    }
}
